import { createSlice } from '@reduxjs/toolkit'

export const dataSlice = createSlice({
  name: 'data',
  initialState: {
    dictionary: {},
    menu: []
  },
  reducers: {
    setDictionary: (state, action) => {
      state.dictionary = {
        ...state.dictionary,
        ...action.payload
      }
    },
    setMenu: (state, action) => {
      state.menu = action.payload
    }
  }
})

export const { setDictionary, setMenu } = dataSlice.actions
export default dataSlice.reducer